package com.xc.freeapp.exception;

import com.xc.freeapp.common.MsgConfig;
import com.xc.freeapp.util.Constant;

public class BaseException extends Exception{
	private String code=Constant.GLOBAL_ERROR;
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	private static final long serialVersionUID = 1L;

	public BaseException() {
		super();
	}

	public BaseException(String message, Throwable cause,
			boolean enableSuppression, boolean writableStackTrace) {
		super();
	}

	public BaseException(String message, Throwable cause) {
		super(message, cause);
	}

	public BaseException(Throwable cause) {
		super(cause);
	}
	
	public BaseException(String code){
		super(MsgConfig.getMsg(code));
		this.code = code;
	}
	
	public BaseException(String code,Object... params){
		super(MsgConfig.getMsg(code,params));
		this.code = code+"";
	}
	public static void throwBaseException(String code)throws BaseException{
		throw new BaseException(code);
	}
	
	public static void throwBaseExceptionByName(String code,Object...params)throws BaseException{
		throw new BaseException(code,params);
	}
}
